package com.ruoyi.rsikManage.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;

import com.ruoyi.rsikManage.domain.TVideoDiagnosticPlanning;
import com.ruoyi.rsikManage.service.ITVideoDiagnosticPlanningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 【诊断方案】Controller
 * 
 * @author ruoyi
 * @date 2023-10-13
 */
@RestController
@RequestMapping("/riskManage/planning")
public class TVideoDiagnosticPlanningController extends BaseController
{
    @Autowired
    private ITVideoDiagnosticPlanningService tVideoDiagnosticPlanningService;

    /**
     * 查询【诊断方案】列表
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:planning:list')")
    @GetMapping("/list")
    public TableDataInfo list(TVideoDiagnosticPlanning tVideoDiagnosticPlanning)
    {
        startPage();
        List<TVideoDiagnosticPlanning> list = tVideoDiagnosticPlanningService.selectTVideoDiagnosticPlanningList(tVideoDiagnosticPlanning);
        return getDataTable(list);
    }

//    /**
//     * 导出【诊断方案】列表
//     */
//    //@PreAuthorize("@ss.hasPermi('riskManage:planning:export')")
//    @Log(title = "【诊断方案】", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, TVideoDiagnosticPlanning tVideoDiagnosticPlanning)
//    {
//        List<TVideoDiagnosticPlanning> list = tVideoDiagnosticPlanningService.selectTVideoDiagnosticPlanningList(tVideoDiagnosticPlanning);
//        ExcelUtil<TVideoDiagnosticPlanning> util = new ExcelUtil<TVideoDiagnosticPlanning>(TVideoDiagnosticPlanning.class);
//        util.exportExcel(response, list, "【诊断方案】数据");
//    }

    /**
     * 获取【诊断方案】详细信息
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:planning:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tVideoDiagnosticPlanningService.selectTVideoDiagnosticPlanningById(id));
    }

    /**
     * 新增【诊断方案】
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:planning:add')")
    @Log(title = "【诊断方案】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TVideoDiagnosticPlanning tVideoDiagnosticPlanning)
    {
        return toAjax(tVideoDiagnosticPlanningService.insertTVideoDiagnosticPlanning(tVideoDiagnosticPlanning));
    }

    /**
     * 修改【诊断方案】
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:planning:edit')")
    @Log(title = "【诊断方案】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TVideoDiagnosticPlanning tVideoDiagnosticPlanning)
    {
        return toAjax(tVideoDiagnosticPlanningService.updateTVideoDiagnosticPlanning(tVideoDiagnosticPlanning));
    }

    /**
     * 删除【诊断方案】
     */
    //@PreAuthorize("@ss.hasPermi('riskManage:planning:remove')")
    @Log(title = "【诊断方案】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tVideoDiagnosticPlanningService.deleteTVideoDiagnosticPlanningByIds(ids));
    }

}
